// (function () {
// 步骤3：创建echarts实例
import * as echarts from "echarts/core";
import { CanvasRenderer } from "echarts/renderers";
import { GlobeComponent } from "echarts-gl/components";

echarts.use([GlobeComponent, CanvasRenderer]);

var ROOT_PATH =
  "https://cdn.jsdelivr.net/gh/apache/echarts-website@asf-site/examples";
let myChart = echarts.init(document.querySelector(".boxearth"));
console.log(myChart);

// 步骤4：定义配置（指定图表的配置项和数据）

let option = {
  backgroundColor: "#000",
  globe: {
    baseTexture: ROOT_PATH + "/data-gl/asset/world.topo.bathy.200401.jpg",
    heightTexture: ROOT_PATH + "/data-gl/asset/world.topo.bathy.200401.jpg",
    displacementScale: 0.04,
    shading: "realistic",
    environment: "../imgs/3D地球柱图 (1).png",
    realisticMaterial: {
      roughness: 0.9,
    },
    postEffect: {
      enable: true,
    },
    light: {
      main: {
        intensity: 5,
        shadow: true,
      },
      ambientCubemap: {
        texture: ROOT_PATH + "/data-gl/asset/pisa.hdr",
        diffuseIntensity: 0.2,
      },
    },
  },
};

// 步骤5：使用刚指定的配置项和数据显示图表
myChart.setOption(option);

//   window.onresize = function () {
//     myChart.resize();
//   };
// })();
